﻿@using Storage.Mapping.AppStorage
@model List<AppStorageMapping>
@{
    ViewBag.Title = "系统列表";
}

    <h1>@ViewBag.Title</h1>
    <hr />
    <div class="row">
        <div class="col-sm-12">
            @PermissionAjaxRouteLinkIcon("添加应用", "editAppStorage", null, new { @class = "btn btn-sm btn-pink " }, new { @class = "glyphicon glyphicon-plus" })
        </div>
    </div>
    <div class="space-2"></div>
    @if (Model != null)
    {
        <div class="row">
            <div class="col-sm-12">
                <div class="tabbable tabs-left">
                    <ul class="nav nav-tabs" id="myTab3">
                        @{
                            string css = "";

                        }
                        @for (int i = 0; i < Model.Count(); i++)
                        {
                            if (i == 0)
                            {
                                css = "active";
                            }
                            else
                            {
                                css = "";
                            }
                            <li class="@css">
                                <a data-toggle="tab" href="#@Model[i].AppKey">
                                    <i class="pink ace-icon fa fa-tachometer bigger-110"></i>
                                    @Model[i].Name
                                </a>
                            </li>
                        }
                    </ul>
                    <div class="tab-content">
                        @for (int i = 0; i < Model.Count(); i++)
                        {
                            if (i == 0)
                            {
                                css = "active";
                            }
                            else
                            {
                                css = "";
                            }
                            <div id="@Model[i].AppKey" class="tab-pane @css">
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 应用名称 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].Name</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 应用Key </div>

                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].AppKey</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 根目录 </div>

                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].RootDirectory</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 密钥 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].SecretKey</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 创建时间 </div>
                                    <div class="profile-info-value">
                                        <span class=" " id="username">@Model[i].CreationTime.ToString("F")</span>
                                    </div>
                                </div>
                                <h4 class="header blue bolder smaller">水印设置</h4>

                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 水印类型 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].WaterType</span>
                                    </div>(标注：0：图片水印，1：文字水印)
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 水印位置 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].Position</span>
                                    </div>(标注：0:左上,1:中上,2:右上,3:左中,4:中中,5:右中,6:左下,7:中下,8:右下)
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name">透明度</div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].Opacity</span>
                                    </div>(标注：0-100，数值越小越透明)
                                </div>
                                <h4 class="header blue bolder smaller">文字水印相关设置</h4>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 水印文字 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].FontText</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 字体大小 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@Model[i].FontSize</span>
                                    </div>（标注：px为单位）
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 字体 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@(Model[i].FontFamily ?? "无")</span>
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 字体颜色 </div>
                                    <div class="profile-info-value">
                                        <span class="editable editable-click" id="username">@(Model[i].FontColor ?? "无")</span>
                                    </div>
                                </div>
                                <h4 class="header blue bolder smaller">图片水印图</h4>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> 图片水印图 </div>
                                    <div class="profile-info-value">
                                        <span class="profile-picture">
                                            <img id="avatar" class="editable img-responsive editable-click editable-empty" alt="没有水印图片" src="@Url.RouteUrl("waterImage", new { id = Model[i].Id })" style="background:#000;">
                                        </span>（标注：为了方便查看图片背景Style设置黑色）
                                    </div>
                                </div>
                                <div class="profile-info-row">
                                    <div class="profile-info-name"> </div>
                                    <a class="btn btn-link" href="@Url.RouteUrl("homeIndex")#page@(Url.RouteUrl("editAppStorage",new { id = Model[i].Id}))">修改</a>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
        <script>
            $(function () {
                $('.btnDelete').click(function (e) {
                    e.preventDefault();
                    var url = $(this).attr('href');
                    $.modal.confirm('您确定要删除？', function () {
                        $.get(url, function (data) {
                            $.modal.alert(data, function () {
                                
                            });
                        });
                    });
                });
            });
        </script>
} 